<template>
	<view class="content">
        <u-navbar bgColor="#fff" :fixed="true" :safeAreaInsetTop="true" :placeholder="true"
            @leftClick="back" title="统计分析">
        </u-navbar>
        <view class="uni-total-analyse subsection">
            <u-subsection bgColor="#fff" fontSize="14" :list="tab" :current="current" @change="e=>current=e"></u-subsection>
        </view>

        <view class="uni-area">
            <!-- @change="e=>current=e.detail.current"  -->
            <swiper class="swiper" :current="current" :disable-touch="true" :style="{height:swiperH+'px'}">

                <!-- 单位 -->
                <swiper-item>
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <view class="uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="单位统计"/> <!-- 原为企业统计 -->
                            <!-- 筛选 -->
                            <view class="u-flex colony" @tap="colony.show=true">
                                <text class="u-m-r-16 u-font-26">{{colony.label}}</text>
                                <u-icon name="arrow-down" size="13" color="#5D6672"></u-icon>
                            </view>
                            <view style="height:416rpx">
                                <qiun-data-charts type="pie" 
                                    :tooltipShow="true" tooltipFormat="enterpriseManageTooltip"
                                    :opts="enterprises.opts"
                                    :chartData="enterprises" />
                            </view>
                        </view>
                    </view>
                </swiper-item>
               
                <!-- 项目 -->
                <swiper-item>
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                       <view class="uni-shadow u-p-l-10 u-p-t-10">
                            <qiun-title-bar title="综合统计"/>
                            <view class="u-m-t-10 u-flex u-row-between u-p-l-20">
                                <text class="font-bold uni-dec-color">项目分布情况</text>
                                <text class="u-font-26 uni-gery-color">单位：个</text>
                            </view>
                            <view style="height:416rpx">
                                <qiun-data-charts type="pie" :tooltipShow="true" tooltipFormat="tooltipDemo1"
                                    :opts="projectData.isOpts?projectData.opts:{}" :chartData="projectData" />
                            </view>
                        </view>
                    </view>
                </swiper-item>

                <!-- 专户 -->
                <swiper-item>
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <text class="u-font-32 font-bold">专户统计</text>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="开户情况统计"/>
                            <text class="u-font-26 uni-gery-color unit">单位：个</text>
                            <view style="height:520rpx">
                                <qiun-data-charts type="column" 
                                    :tooltipShow="true" tooltipFormat="pileTooltip"
                                    :opts="{dataLabel:false,extra:{column:{type:'stack'}}}" :chartData="openData"/>
                            </view>
                        </view>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="开户银行" unit="  专户余额" />
                            <text class="u-font-26 uni-gery-color unit">单位：万元</text>
                            <view class="u-m-t-20" style="height:520rpx">
                                <qiun-data-charts type="column"
                                    :tooltipShow="true" tooltipFormat="pileTooltip" 
                                    :opts="openBankData1.opts" :chartData="openBankData1" />
                            </view>
                        </view>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="开户银行" unit="  专户个数" />
                            <text class="u-font-26 uni-gery-color unit">单位：个</text>
                            <view class="u-m-t-20" style="height:520rpx">
                                <qiun-data-charts type="column" 
                                    :tooltipShow="true" tooltipFormat="pileTooltip"
                                    :opts="openBankData2.opts" :chartData="openBankData2" />
                            </view>
                        </view>
                    </view>
                </swiper-item>

                <!-- 人员 -->
                <swiper-item>
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <text class="u-font-32 font-bold">综合统计</text>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="工人情况"/>
                            <text class="u-font-26 uni-gery-color unit">单位：人</text>
                            <u-row class="u-flex u-flex-wrap">
                                <u-col span="3" v-for="(item,index) in workers" :key="index" class="u-m-t-24">
                                    <text class="u-text-center u-font-24 uni-dec-color">{{item.title}}</text>
                                    <text class="u-m-t-14 u-text-center u-font-42 font-bold">{{item.value}}</text>
                                </u-col>
                            </u-row>
                        </view>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="工人分布情况"/>
                            <text class="u-font-26 uni-gery-color unit">单位：人</text>
                            <view class="u-m-t-20" style="height:520rpx">
                                <qiun-data-charts type="line" :ontouch="true" :canvas2d="true"
                                    :opts="memberData.categories.length>5?memberData.opts:{}"
                                    :chartData="memberData" />
                            </view>
                        </view>
                    </view>
                </swiper-item>

                <!-- 考勤 -->
                <swiper-item>
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <text class="u-font-32 font-bold">综合统计</text>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="工人情况"/>
                            <text class="u-font-26 uni-gery-color unit">单位：人</text>
                            <u-row class="u-flex u-flex-wrap">
                                <u-col span="3" v-for="(item,index) in workers" :key="index" class="u-m-t-24">
                                    <text class="u-text-center u-font-24 uni-dec-color">{{item.title}}</text>
                                    <text class="u-m-t-14 u-text-center u-font-42 font-bold">{{item.value}}</text>
                                </u-col>
                            </u-row>
                        </view>
                    </view>
                </swiper-item>

                <!-- 工资 -->
                <swiper-item>
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <text class="u-font-32 font-bold">综合统计</text>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="工资发放情况"/>
                            <text class="u-font-26 uni-gery-color unit">单位：万元</text>
                            <view style="height:416rpx">
                                <qiun-data-charts type="pie" :tooltipShow="true" tooltipFormat="tooltipDemo1"
                                    :opts="projects.opts" :chartData="projects" />
                            </view>
                        </view>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="本月工资发放情况"/>
                            <view class="u-m-t-20" style="height:520rpx">
                                <qiun-data-charts type="line" 
                                    :ontouch="true" :canvas2d="true"
                                    :opts="monthWageFafangData.opts"
                                    :chartData="monthWageFafangData" />
                            </view>
                        </view>
                    </view>
                </swiper-item>

                <!-- 预警 -->
                <swiper-item v-if="false">
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <text class="u-font-32 font-bold">预警情况统计</text>
                        <view class="u-m-t-30 uni-shadow uni-echarts-box">
                            <u-row>
                                <u-col v-for="(item,index) in warnings" :key="index"
                                    span="6" style="flex-direction:row; justify-content:center; border-right:1rpx solid #eee;">
                                    <u--image :src="item.icon" width="80rpx" height="80rpx" shape="circle"></u--image>
                                    <view class="u-m-l-20 u-felx u-flex-col">
                                        <text class="u-font-42 font-bold">{{item.value}}</text>
                                        <text class="u-m-t-6 u-font-24 uni-dec-color">{{item.title}}</text>
                                    </view>
                                </u-col>
                            </u-row>
                        </view>
                        <view class="u-m-t-30 uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <view class="u-p-t-100" style="height:620rpx">
                                <qiun-data-charts type="pie" 
                                    :opts="{legend:{position:'bottom',float:'left',lineHeight:20}}" 
                                    :chartData="warningEcharts" />
                            </view>
                        </view>
                    </view>
                </swiper-item>

                <!-- 督办 -->
                <swiper-item v-if="false">
                    <view class="swiper-item u-m-t-30 u-m-b-30">
                        <view class="uni-shadow u-p-l-10 u-p-t-10 uni-echarts-box">
                            <qiun-title-bar title="预警督办"/>
                            <u-row class="u-flex u-flex-wrap">
                                <!-- v-if="index<4" -->
                                <u-col span="3" v-for="(item,index) in duBans" :key="index" class="u-m-t-24">
                                    <text class="u-text-center u-font-24 uni-dec-color">{{item.title}}</text>
                                    <view class="u-m-t-14 u-text-center u-col-bottom">
                                        <text class="u-font-42 font-bold">{{item.value}}</text>
                                        <text class="u-font-24">个</text>
                                    </view>
                                </u-col>
                            </u-row>
                        </view>
                        <view class="u-m-t-30 uni-shadow uni-echarts-box">
                            <text>本月督办</text>
                            <u-row class="u-m-t-30">
                                <!-- v-if="index>3&&index<6"  -->
                                <u-col span="6" v-for="(item,index) in duBans" :key="index" :class="[index==4?'border':'']" style="align-items:center">
                                    <text class="u-font-24 uni-dec-color">{{item.title}}</text>
                                    <view class="u-m-t-20">
                                        <text class="u-font-42 font-bold">{{item.value}}</text>
                                        <text class="u-font-24">个</text>
                                    </view>
                                </u-col>
                            </u-row>
                        </view>
                        <view class="u-m-t-30 uni-shadow uni-echarts-box">
                            <text>历史督办</text>
                            <u-row class="u-m-t-30">
                                <!-- v-if="index>5" -->
                                <u-col span="6" v-for="(item,index) in duBans" :key="index" :class="[index==6?'border':'']" style="align-items:center">
                                    <text class="u-font-24 uni-dec-color">{{item.title}}</text>
                                    <view class="u-m-t-20">
                                        <text class="u-font-42 font-bold">{{item.value}}</text>
                                        <text class="u-font-24">个</text>
                                    </view>
                                </u-col>
                            </u-row>
                        </view>
                    </view>
                </swiper-item>
            </swiper>

            <!-- 属地筛选 -->
            <u-picker :show="colony.show" :columns="colony.data" keyName="label" :closeOnClickOverlay="true"
                @cancel="colony.show=false" @close="colony.show=false" @confirm="selectColony">
            </u-picker>
        </view>
        
        <!-- 提示组件 -->
        <u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
                systemInfo: uni.getStorageSync('systemInfo'),
                swiperH: 731,
                userInfo: uni.getStorageSync('userInfo'),

				// tab:['企业','项目','专户','人员','考勤','工资','预警','督办'],
				tab:['单位','项目','专户','人员','考勤','工资'],
                current: 0,

                // 属地筛选
                colony:{
                    show: false,
                    label: '一师',
                    districtId: 1,
                    data: [[
                        { label: '一师', value: 1 },
                    ]]
                },
                // 企业统计
                enterprises:{
                    series: [
                        // {
                        //     data: [
                        //         { name: "住建", value: 50 }, 
                        //     ],
                        //     format: 'yAxisDemo1', // label数据式化
                        // }
                    ],
                    opts: {
                        extra: {
                            pie: {
                                customRadius: 50,
                                offsetAngle: 90
                            }
                        }
                    }
                },

                // 项目
                projectData:{
                    series: [
                        // {
                        //     data: [
                        //         // { name: "住建：50", value: 50 }
                        //     ],
                        //     format: 'yAxisDemo1', // 数据格式化
                        // }
                    ],
                    isOpts: false, // 默认对图表显示不做修改
                    opts:{
                        fontSize:12,
                        legend:{
                            lineHeight: 10,
                            padding: 2,
                            margin: 2
                        }
                    }
                },

                // 开户情况
                openData:{
                    categories: [ "已开户","已撤销","未开户"],
                    series: [
                        // {
                        //     name: "中国农业银行",
                        //     data: [2,0,1]
                        // },
                        // {
                        //     name: "中国建设银行",
                        //     data: [1,0,1]
                        // },
                        // {
                        //     name: "中国交通银行",
                        //     data: [0,0,1]
                        // },
                        // {
                        //     name: "邮储银行",
                        //     data: [0,0,1]
                        // },
                        // {
                        //     name: "其它",
                        //     data: [1,0,1]
                        // }
                    ]
                },
                // 开户银行(暂时弃用)
                openBankData:{
                    categories: [ "中国银行","交通银行","农业银行","邮政银行"],
                    series: [
                        {
                            name: "住建",
                            data: [1,2,3,4],
                            stack: "one",
                        },
                        {
                            name: "水利",
                            data: [1,2,3,4],
                            stack: "one",
                        },
                        {
                            name: "交通",
                            data: [1,2,3,4],
                            stack: "one",
                        },
                        {
                            name: "农村农业",
                            data: [1,2,3,4],
                            stack: "one",
                        }
                    ],
                    opts:{
                        extra:{
                            column:{ type:'stack' }
                        },
                        yAxis: {
                            showTitle:true,
                            data: [
                                {
                                    position: 'left',
                                    title: '专户余额(万元)',
                                    titleOffsetX: 15,
                                    titleOffsetY: -8,
                                }, 
                                {
                                    position: 'right',
                                    title: '专户个数(个)',
                                    titleOffsetY: -8,
                                }
                            ]
                        },
                    },
                },
                // 开户银行 专户余额
                openBankData1:{
                    categories: [],
                    series: [],
                    opts:{
                        dataLabel:false,
                        extra:{
                            column:{ type:'stack' }
                        },
                    },
                },
                // 开户银行 专户个数
                openBankData2:{
                    categories: [],
                    series: [],
                    opts:{
                        dataLabel:false,
                        extra:{
                            column:{ type:'stack' }
                        },
                    },
                },

                // 人员&考勤工人情况
                workers:[ 
                    { filed:'staffs', title:'实名制人数', value: 0 },
                    { filed:'istaffs', title:'进场工人数', value: 0 },
                    { filed:'ostaffs', title:'离场工人数', value: 0 },
                    { filed:'wstaffs', title:'待进场工人数', value: 0 },
                ],
                // 工人分布情况
                memberData:{
                    categories:['住建','水利','交通','农村农业','其它'],
                    series:[
                        // {
                        //     "name": "实名制进场人数",
                        //     "data": [35,8,25,37,88]
                        // },
                        // {
                        //     "name": "考勤总人数",
                        //     "data": [ 70, 40, 65, 100,88]
                        // },
                    ],
                    opts:{ 
                        yAxis: {
                            showTitle:true,
                            data: [
                                {
                                    position: 'left',
                                    title: '发放余额(万元)',
                                    titleOffsetX: 15,
                                    titleOffsetY: -8,
                                }, 
                                {
                                    position: 'right',
                                    title: '发放人数(人)',
                                    titleOffsetX: -15,
                                    titleOffsetY: -8,
                                }
                            ]
                        },
                        enableScroll: true, 
                        xAxis:{
                            itemCount: 3,
                            rotateLabel: false,
                            scrollShow:true,
                            disableGrid:true
                        },
                    }
                },

                // 工资发放情况
                projects:{
                    series: [
                        // {
                        //     data: [
                        //         // { name: "一师:50", value: 50 }
                        //     ],
                        //     format: 'yAxisDemo1', // 数据格式化
                        // }
                    ],
                },
                // 本月工资发放情况
                monthWageFafangData:{
                    categories: ['一师','二师','三师','四师'],
                    series:[
                        // {
                        //     index: 0, 
                        //     name: "发放金额",
                        //     data: [35,8,25,37]
                        // },
                        // {
                        //     index: 1,
                        //     name: "发放人数",
                        //     data: [ 70, 40, 65, 100]
                        // },
                    ],
                    opts:{
                        yAxis: {
                            showTitle:true,
                            data: [
                                {
                                    position: 'left',
                                    title: '发放金额(万元)',
                                    titleOffsetX: 15,
                                    titleOffsetY: -8,
                                }, 
                                {
                                    position: 'right',
                                    title: '发放人数(人)',
                                    titleOffsetX: -15,
                                    titleOffsetY: -8,
                                }
                            ]
                        },
                        enableScroll: true, xAxis: {scrollShow:true,itemCount:5,disableGrid:true}
                    },
                },

                // 预警情况统计
                warnings:[
                    { icon:'/static/icons/warn1.png',title:'本月预警', value: 0 },
                    { icon:'/static/icons/warn2.png',title:'累计预警', value: 0 },
                ],
                warningEcharts:{
                    series: [
                        // {
                        //     data: [
                        //         // { name: "住建", value: 50 }
                        //     ],
                        //     format: 'totalWarn', // 数据格式化
                        // }
                    ],
                },

                // 督办
                duBans:[
                    { filed:'zjxm', title:'在建项目', value: 0 },
                    { filed:'jrdb', title:'今日预警', value: 0 },
                    { filed:'bydb', title:'本月督办', value: 0 },
                    { filed:'lsdb', title:'今日督办', value: 0 },
                    { filed:'ydbxms_by', title:'已督办项目数', value: 0 },
                    { filed:'wdbxms_by', title:'未督办项目数', value: 0 },
                    { filed:'ydbxms_ls', title:'已督办项目数', value: 0 },
                    { filed:'wdbxms_ls', title:'未督办项目数', value: 0 },
                ]
			}
		},

        onReady(){
            uni.createSelectorQuery().in(this).select('.subsection').boundingClientRect(res => {
                this.swiperH = this.systemInfo.normalContentH - res.height 
            }).exec();
        },

        onLoad() {
            // 属地
            this.$tools.getNationFn(this,{},res=>{
                this.colony.label = res.list[0].label
                this.colony.districtId = res.list[0].value
                this.colony.data.splice(0,1,res.list)
                // 企业
                this.getEntTotal()

                // 项目
                this.getProjectDis()
                
                // 开户情况统计
                this.getKaihuData()
                // 开户银行
                this.getKaihuBank()

                // 人员&考勤工人情况
                this.getTotalWorker()
                // 工人分布
                this.getStaffInfoEcharts()

                // 工资发放情况
                this.getProjectTotal()
                // 本月工资发放情况
                this.getTotalMonthWage()

                // 预警情况统计
                this.getWarningTotal()
                // 预警图表
                this.getWarningEcharts()

                // 督办概览(暂时隐藏)
                // this.getDubanOverview()
            })
		},

		methods: {
            // 返回
            back(){
                uni.navigateBack()
            },

            // 企业
            getEntTotal(){
                const parameter = { districtId:this.colony.districtId}
                // console.log('企业统计-参数',parameter)
                this.$request(this,this.$apis.entTotalSS,parameter).then(res=>{
                    // console.log('企业统计',res)
                    this.enterprises.series = [ { data: [],format: 'yAxisDemo1' } ]
                    let entTotal = 0
                    res.map((v,i)=>{
                        entTotal += Number(v.value)
                    })
                    res.map((v,i)=>{
                        this.enterprises.series[0].data.push({
                            name: v.name + ' ' + ((v.value/entTotal)*100).toFixed(2)+'%',
                            value: v.value,
                            label: v.name
                        })
                    })
                }).then()
            },
            // 企业-选择属地
            selectColony(e){
                this.colony.label = e.value[0].label
                this.colony.districtId = e.value[0].value
                this.colony.show = false
                this.getEntTotal()
            },

            // 项目
            getProjectDis(){
                this.$request(this,this.$apis.projectChartDis,{}).then(res=>{
                    // console.log('项目分布',res)
                    this.projectData.series = [ { data: [],format: 'yAxisDemo1' } ]
                    res.map((v,i)=>{
                        this.projectData.series[0].data.push({
                            name: v.name+':'+v.value,
                            value: v.value,
                            label: v.name,
                        })
                    })
                }).then()
            },

            // 开户情况统计
            getKaihuData(){
                this.$request(this,this.$apis.account,{}).then(res=>{
                    // console.log('开户情况',res)
                    this.openData.categories = []
                    this.openData.series = []
                    // 提取所有银行并去重
                    const arr = []
                    res.map((v,i)=>{
                        this.openData.categories.push(v.name)
                        try {
                            v.data.map((a,b)=>{
                                arr.push(a.bankType)
                            })
                        } catch (error) {}
                    })
                    const arr1 = Array.from(new Set(arr))
                    // 赋值
                    const series = []
                    arr1.map((v,i)=>{
                        series.push({ name: v, data: [] })
                    })
                    series.map((v, i) => {
                        res.map((a, b) => {
                            if( a.data ){
                                a.data.map((c, d) => {
                                    if ( v.name == c.bankType ) {
                                        v.data[b] = c.account
                                    }
                                })
                            }else{
                                v.data[b] = 0
                            }
                        })
                    })
                    this.openData.series = series
                    // console.log('开户情况',this.openData)
                }).then()
            },
            // 开户银行
            getKaihuBank(){
                this.$request(this,this.$apis.totalBank,{}).then(res=>{
                    // console.log('开户银行',res)
                    this.openBankData1.categories = []
                    this.openBankData2.categories = []
                    this.openBankData1.series = []
                    this.openBankData2.series = []
                    res.map((v,i)=>{
                        this.openBankData1.categories.push(v.name.split('银行')[0]) // 专户余额
                        this.openBankData2.categories.push(v.name.split('银行')[0]) // 专户个数
                    })
                    // 得到所有项目
                    const arr = []
                    res.map((v,i)=>{
                        try {
                            v.data.map((a,b)=>{
                                arr.push(a.name)
                            })
                        } catch (error) {}
                    })
                    const arr1 = Array.from(new Set(arr))
                    // 赋值
                    const series1 = []
                    const series2 = []
                    arr1.map((v,i)=>{
                        series1.push({ name: v, data: [] })
                        series2.push({ name: v, data: [] })
                    })
                    series1.map((v, i) => {
                        res.map((a, b) => {
                            if( a.data ){
                                a.data.map((c, d) => {
                                    if ( v.name == c.name ) {
                                        v.data[b] = c.balance
                                    }
                                })
                            }else{
                                v.data[b] = 0
                            }
                        })
                    })
                    series2.map((v, i) => {
                        res.map((a, b) => {
                            if( a.data ){
                                a.data.map((c, d) => {
                                    if ( v.name == c.name ) {
                                        v.data[b] = c.account
                                    }
                                })
                            }else{
                                v.data[b] = 0
                            }
                        })
                    })
                    this.openBankData1.series = series1
                    this.openBankData2.series = series2
                }).then()
            },


            // 工人情况
            getTotalWorker(){
                uni.showLoading({ title:'工人情况加载中' })
                this.$request(this,this.$apis.totalWorker,{}).then(res=>{
                    // console.log('工人情况',res)
                    this.workers.map((v,i)=>{
                        v.value = res[v.filed]
                    })
                }).then()
            },
            // 工人分布---不用根据角色(兵团&师级)分开调用接口,现有接口返回了不同数据
            getStaffInfoEcharts(){
                uni.showLoading({ title:'工人分布加载中'})
                this.$request(this,this.$apis.staffInfoEcharts,{}).then(res=>{
                    // console.log('工人分布',res)
                    this.memberData.categories = []
                    this.memberData.series = [
                        { index: 0, name: "实名制进场人数", data: [] },
                        { index: 1, name: "考勤总人数", data: [] }
                    ]
                    res.map((v,i)=>{
                        this.memberData.categories.push(v.districtName?v.districtName:v.projectType)
                        this.memberData.series[0].data.push(v.staffs) // 实名制进场人数
                        this.memberData.series[1].data.push(v.atdStaffs) // 考勤总人数
                    })
                }).then()
            },


            // 工资发放情况
            getProjectTotal(){
                uni.showLoading({ title:'工资发放情况' })
                const parameter = {
                    salaryDate: this.$tools.formatTime(new Date()).ym
                }
                this.$request(this, this.$apis.wgProjectTotal, {}).then(res => {
                    // console.log('工资发放情况',res)
                    this.projects.series = [ { data: [],format: 'yAxisDemo1' } ]
                    res.map((v,i)=>{
                        this.projects.series[0].data.push({
                            name: v.projectType+' '+v.salary,
                            value: v.salary,
                            label: v.projectType,
                        })
                    })
                }).then()
            },
            // 本月工资发放情况
            getTotalMonthWage(){
                uni.showLoading({ title:'本月工资发放' })
                this.$request(this, this.$apis.totalMonthWage, {}).then(res => {
                    // console.log('本月工资发放情况',res)
                    this.monthWageFafangData.categories = []
                    this.monthWageFafangData.series = [
                        { index: 0,  name: "发放金额", data: [] },
                        { index: 1, name: "发放人数", data: [] },
                    ]
                    res.map((v,i)=>{
                        this.monthWageFafangData.categories.push(v.districtName)
                        this.monthWageFafangData.series[0].data.push(v.salary)
                        this.monthWageFafangData.series[1].data.push(v.staffs)
                    })
                }).then()
            },


            // 预警情况统计
            getWarningTotal(){
                uni.showLoading({ title:'预警情况统计' })
                this.$request(this, this.$apis.warning,{districtId:this.userInfo.districtId}).then(res => {
                    // console.log('预警情况统计',res)
                    this.warnings[0].value = res.mvalue
                    this.warnings[1].value = res.value
                }).then()
            },
            // 预警图表
            getWarningEcharts(){
                uni.showLoading({ title:'预警' })
                this.$request(this, this.$apis.warningEcharts,{}).then(res => {
                    // console.log('预警',res)
                    this.warningEcharts.series = [ { data: [], format: 'totalWarn' } ]
                    res.map((v,i)=>{
                        this.warningEcharts.series[0].data.push({
                            name: v.name,
                            value: v.value
                        })
                    })
                }).then()
            },


            // 督办概览
            getDubanOverview(){
                uni.showLoading({ title:'督办概览' })
                this.$request(this, this.$apis.dubanOverview,{}).then(res => {
                    // console.log('督办概览',res)
                    this.duBans.map((v,i)=>{
                        v.value = res[v.filed]
                    })
                }).then()
            }
		}
	}
</script>

<style lang="scss">
    .content{
        .subsection{
            padding: 0 30rpx;
            box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.05);
        }
        .border{
            border-right:1rpx solid #eee;
        }
        // 企业
        .uni-echarts-box{
            .colony{
                position: absolute;
                top: 30rpx;
                right: 30rpx;
            }
        }
    }
</style>
